:root {
  --math-init-font-size:    20px;
}

span.math, span.math span { /* Don't want to modify the display of tables. */
  vertical-align:   middle;
  position:         relative; /* 2020-03-14: Really usefull? */
  display:          inline-block;
  break-inside:     avoid;
  white-space:      nowrap;
}

span.math:not(table.matrix *[rowspan] > *) {
  text-align:       center;
  font-family:
    TeX Gyre Termes, FreeSerif,
    Times New Roman, serif;
  font-size:        var(--math-init-font-size);
  line-height:      1;
}

span.math span.math {
  font-size:        inherit;
}

span.frac {
  /* vertical-align:   middle; */
  text-align:       center;
  padding-left:     2pt;
  padding-right:    2pt;
}

span.frac-num, span.frac-den {
  width:            100%; /* 2020-03-13: not sure if this always works. */
  padding-left:     2pt;
  padding-right:    2pt;
}

span.frac-num {
  /* 2021-10-01: border-top may be used by radicand of "span.frac-den". */
  border-bottom:    solid 1px;
  padding-bottom:   3pt;
}

span.frac-den {
  bottom:           2pt; /* 2021-10-01: account for actual font metrics. */
}

span.radicand { /* The expression to evaluate the radical for. */
  border-top:       solid 1pt;
  padding:          1pt 0.0em;
}

span.radical { /* The radical sign just before the expression. */
}

/* 2020-03-13: deco: desize content, enco: enlarge content. */

/* decoration, superscript, subscript. */
span.deco, sup, sub {
  display:          inline-block;
  font-size:        74.54%; /* rsqrt(1.8) */
}

span.enco { /* encompass. */
  font-size:        134.2%; /* sqrt(1.8) */
}

span.enco2 { /* encompass twice. */
  font-size:        180%;
  padding:          0.2ex 0.0ex;
}

span.enco2-int { /* encompass twice. */
  font-family:
    TeX Gyre Termes Math, FreeSerif,
    Times New Roman, serif;
  transform:        scaleY(2.8) skewX(-28deg);
  padding:          0.2ex 0.0ex;
}

span.enco2-int ~ span.aleft {
  position:         relative;
}

span.enco2-int ~ span.aleft span.rsh {
  position:         relative;
  left:             1ex;
}

span.enco2-int ~ span.aleft span.lsh {
  position:         relative;
  left:             -1ex;
}

span.deco, span.enco {
  vertical-align:   middle;
}

span.aleft {
  text-align:       left;
}

span.aright {
  text-align:       right;
}

table.matrix {
  border-spacing:   6pt;
}

table.matrix *[rowspan] > *,
table.matrix *[rowspan] {
  line-height:      0.9;
  font-family:
    TeX Gyre Termes, FreeSerif,
    Times New Roman, serif;
}

div.p { /* HTML5 doesn't seem to like nesting table in paragraphs. */
  margin:           1.12em 0;
}
